<template>
	<view class="search" :class="{'no_border': !border}" :style="{backgroundColor:bgColor}">
		<view class="img_wraper" >
			<image class="img" src="../../static/images/icon_search.png"></image>
		</view>
		<view class="input_wraper">
			<input class="inp" type="text" :value="value" :maxlength="maxlength" :placeholder="placeholder" @input="inputChange"/>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		maxlength: { // 最大长度
			type: Number,
			default: 50
		},
		placeholder: { // 默认文案
			type: String,
			default: "请输入内容"
		},
		border:{ // 是否有边框
			type: Boolean,
			default: true
		},
		bgColor:{
			type: String,
			default: "#FFFFFF"
		},
		value:{
			type: String,
			default: ""
		}
	},
	data() {
		return {};
	},
	watch: {},
	methods: {
		inputChange(e){
			this.$emit('change', e.detail.value);
		}
	},
	mounted() {}
};
</script>

<style lang="scss" scoped>
.search{
	height:80rpx;
	font-size:28rpx;
	font-weight:300;
	box-sizing: border-box;
	color:rgba(121,132,152,1);
	border:1rpx solid rgba(209,215,225,1);
	border-radius:4rpx;
	display: flex;
	justify-content: flex-start;
	background-color: #FFFFFF;
	.img_wraper{
		margin: 0 10rpx;
		padding: 20rpx 0;
		.img{
			width: 40rpx;
			height: 40rpx;
		}
	}
	.input_wraper{
		flex: 2;
		.inp{
			height:80rpx;
			line-height: 80rpx;
			font-size:28rpx;
		}
	}
}
.no_border{
	border: none;
}
</style>
